package io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Text02 {
    public static void main(String[] args) throws IOException {
        Scanner scanner=new Scanner(System.in);
        FileOutputStream fos=new FileOutputStream("note.txt");
        OutputStreamWriter oos=new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        System.out.println("开始输入内容，单独输入exit退出");
        while (true) {
            String ss = scanner.nextLine();
            if ("exit".equalsIgnoreCase(ss)) {
                break;
            }
            oos.write(ss);
        }
            oos.close();
            System.out.println("程序退出");


    }
}
